package com.bruce.apkinstaller;

import android.app.AlertDialog;
import android.app.Service;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bruce.apkinstaller.view.HorizonalProgress;

import java.util.ArrayList;

/**
 * Created by Administrator on 2018/1/24.
 */

public abstract class BaseService extends Service {

    /*避免多次收到广播*/
    protected boolean isInstallTaskRunning = true;
    protected Context mContext;
    protected int finishedCount;
    protected ArrayList<String> apkList = new ArrayList<>();

    protected final String NAME = "name";
    protected final String PROGRESS = "progress";
    protected final int MSG_PROGRESS = 1001;
    protected Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            handleMsg(msg);
        }
    };

    protected abstract void handleMsg(Message msg);

    /*true:为系统安装方式  false:为命令行安装方式*/
    protected boolean installType;
    /*true:为安装  false:为卸载*/
    protected boolean installOrUninstall;
    protected String apkfile = "/sdcard/htrip/appUpdate/181c1b0a8d3bb1de137ccd2ead01c157.apk";

    protected TextView updatedialogContent;
    protected View view;
    protected AlertDialog.Builder builder;
    protected AlertDialog dialog;
    protected HorizonalProgress mHorizonalProgress;

    @Override
    public void onDestroy() {
        super.onDestroy();
        release();
    }

    protected abstract void release();
}
